package com.roadmap.entities.ext;

import com.roadmap.common.BaseConst;
import com.roadmap.common.RdcResourceBundle;
import com.roadmap.entities.LifeGoal;

public class GoalExt extends LifeGoal {
	private String ownerName;
	private String planId;
	private String planName;
	private String visitorId;
	private int progress;
	private int taskCount;
	private int assignedProportion;
	private String symptom;

	public GoalExt(LifeGoal goal) {
		this.copyValues(goal);
	}

	public String getOwnerName() {
		return ownerName;
	}

	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}

	@Deprecated
	public String getPlanId() {
		return planId;
	}

	@Deprecated
	public void setPlanId(String planId) {
		this.planId = planId;
	}

	@Deprecated
	public String getPlanName() {
		return planName;
	}

	@Deprecated
	public void setPlanName(String planName) {
		this.planName = planName;
	}

	public String getVisitorId() {
		return visitorId;
	}

	public void setVisitorId(String visitorId) {
		this.visitorId = visitorId;
	}

	public boolean getCanCreatePlan() {
		// 访问者必须是goal的owner
		if (this.getAspirantId() == null || this.visitorId == null
				|| !this.getAspirantId().equals(this.visitorId)) {
			return false;
		}

		// 状态必须是UNSCHEDULED
		return getStatus() == BaseConst.LIFEGOAL_STATUS_UNSCHEDULED;
	}

	public int getProgress() {
		return progress;
	}

	public void setProgress(int progress) {
		this.progress = progress;
	}

	public int getTaskCount() {
		return taskCount;
	}

	public void setTaskCount(int taskCount) {
		this.taskCount = taskCount;
	}

	public int getAssignedProportion() {
		return assignedProportion;
	}

	public void setAssignedProportion(int assignedProportion) {
		this.assignedProportion = assignedProportion;
	}

	public String getSymptom() {
		return symptom;
	}

	public void setSymptom(String symptom) {
		this.symptom = symptom;
	}

	public String getStatusDesc() {
		if (getStatus() > 0
				&& getStatus() < RdcResourceBundle.LIFEGOAL_STATUS_DESCRIPTIONS.length) {
			return RdcResourceBundle.LIFEGOAL_STATUS_DESCRIPTIONS[getStatus()];
		}
		return null;
	}
	
}
